package distribuicao;


import java.rmi.AlreadyBoundException;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import distribuicao.impl.ServicoImpl;

public class ServerRmi {
	
	
public static void main(String[] args) {
	
//	
//	System.setProperty("java.security.policy", "file:./java.policy");
//	System.setSecurityManager(new RMISecurityManager());

//	System.setProperty("java.security.policy", "file:./java.policy");
//	System.setSecurityManager(new RMISecurityManager());
	try {
		Servico objetoRemoto = new ServicoImpl();
		Registry r = LocateRegistry.createRegistry(5555);
		r.rebind("RMI", objetoRemoto);
		
		
		System.out.println("Objeto criado e registrado no RMI");
		
	} catch (RemoteException e) {
		e.printStackTrace();
		// TODO: handle exception
	}

}
}
